home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group97a.txt
/
000012_icon-group-sender _Tue Jan 7 10:18:42 1997.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
2KB
Received: by cheltenham.cs.arizona.edu; Tue, 7 Jan 1997 14:36:02 MST
Message-Id: <s2d22454.000@housmtp.oceaneering.com>
X-Mailer: Novell GroupWise 4.1
Date: Tue, 07 Jan 1997 10:18:42 -0600
From: Charlie Hethcoat <CHETHCOA@housmtp.oceaneering.com>
To: gep2@computek.net, icon-group@cs.arizona.edu
Subject: Another Question from the Neophyte -Reply
Mime-Version: 1.0
Content-Type: text/plain
Content-Disposition: inline
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
Content-Length: 1733
The question was how best to scan for the last nonblank token,
as I recall. Using reverse() seems the most natural way to do it, if no
preceding tokens are needed. Otherwise, a normal left-to-right scan to
put tokens on a list (tokenlist) would be best. Then the last token is
found in tokenlist[-1]. An Icon library routine written by Ralph Griswold
does this neatly.
But I do wonder about the implementation of reverse(). If it is a
very efficient operation, I'm sure it's the best general solution. I am
unfamiliar with the Icon source, so I do not know if it moves a lot of data
around, or just resets some pointers and flags to give the appearance of
reversing a string. This would be equivalent to the &direction flag that
Gordon mentioned, but implicit rather than explicit.
So if
s := "A line of text"
then is reverse(s) literally "txet fo enil A", or more like {HEY, ICONX!
SCAN THE FOLLOWING DATA BACKWARDS! pointerto(s)}?
Charlie Hethcoat
>>> <gep2@computek.net> 1997 Jan 06, 11:57am >>>
>... I haven't found a good way to move
backwards, besides first reversing a string and then scanning forward
(which is functionally scanning backwards).
>...I did manage to find a solution, but isn't there less cumbersome way
of
scanning backwards than using reverse()?
There are a variety of kluges which can be used, but honestly I think that
often
the most effective way simply is to use reverse()... since then
everything works
in its most natural way.
There has been talk of implementing a "&direction" item which could be
set
either to +1 or -1 to set the scanning direction, but nobody seems to be
very
excited about that as a general feature.
Gordon Peterson
http://www.computek.net/public/gep2/